// Copyright by LunaSec (owned by Refinery Labs, Inc)
//
// Licensed under the Business Source License v1.1
// (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
//
// https://github.com/lunasec-io/lunasec/blob/master/licenses/BSL-LunaTrace.txt
//
// See the License for the specific language governing permissions and
// limitations under the License.
package advisory

import (
	"github.com/lunasec-io/lunasec/lunatrace/gogen/gql"
)

var (
	VulnerabilityReferenceOnConflict = &gql.Vulnerability_reference_on_conflict{
		Constraint: gql.Vulnerability_reference_constraintReferenceVulnerabilityIdTypeUrlIdx,
		Update_columns: []gql.Vulnerability_reference_update_column{
			gql.Vulnerability_reference_update_columnVulnerabilityId,
			gql.Vulnerability_reference_update_columnType,
			gql.Vulnerability_reference_update_columnUrl,
		},
	}

	CweOnConflict = &gql.Vulnerability_cwe_on_conflict{
		Constraint: gql.Vulnerability_cwe_constraintCwePkey,
		Update_columns: []gql.Vulnerability_cwe_update_column{
			gql.Vulnerability_cwe_update_columnId,
		},
	}

	VulnerabilityCweOnConflict = &gql.Vulnerability_vulnerability_cwe_on_conflict{
		Constraint: gql.Vulnerability_vulnerability_cwe_constraintUniqueVulnerabilityCweVulnerabilityIdCweIdKey,
		Update_columns: []gql.Vulnerability_vulnerability_cwe_update_column{
			gql.Vulnerability_vulnerability_cwe_update_columnVulnerabilityId,
			gql.Vulnerability_vulnerability_cwe_update_columnCweId,
		},
	}

	VulnerabilitySeverityOnConflict = &gql.Vulnerability_severity_on_conflict{
		Constraint: gql.Vulnerability_severity_constraintSeverityVulnerabilityIdSourceTypeIdx,
		Update_columns: []gql.Vulnerability_severity_update_column{
			gql.Vulnerability_severity_update_columnScore,
		},
	}

	VulnerabilityEquivalentOnConflict = &gql.Vulnerability_equivalent_on_conflict{
		Constraint: gql.Vulnerability_equivalent_constraintEquivalentABIdx,
		Update_columns: []gql.Vulnerability_equivalent_update_column{
			gql.Vulnerability_equivalent_update_columnA,
			gql.Vulnerability_equivalent_update_columnB,
		},
	}

	VulnerabilityOnConflictAsEquivalentSubObject = &gql.Vulnerability_on_conflict{
		Constraint: gql.Vulnerability_constraintVulnerabilitySourceSourceIdIdx,
		Update_columns: []gql.Vulnerability_update_column{
			gql.Vulnerability_update_columnSource,
			gql.Vulnerability_update_columnSourceId,
			gql.Vulnerability_update_columnSeverityName,
			gql.Vulnerability_update_columnCveId,
		},
	}

	VulnerabilityCreditOnConflict = &gql.Vulnerability_credit_on_conflict{
		Constraint: gql.Vulnerability_credit_constraintCreditVulnerabilityIdName,
		Update_columns: []gql.Vulnerability_credit_update_column{
			gql.Vulnerability_credit_update_columnVulnerabilityId,
			gql.Vulnerability_credit_update_columnName,
		},
	}

	VulnerabilityAffectedOnConflict = &gql.Vulnerability_affected_on_conflict{
		Constraint: gql.Vulnerability_affected_constraintAffectedVulnerabilityIdPackageIdIdx,
		Update_columns: []gql.Vulnerability_affected_update_column{
			gql.Vulnerability_affected_update_columnDatabaseSpecific,
			gql.Vulnerability_affected_update_columnEcosystemSpecific,
			gql.Vulnerability_affected_update_columnPackageId,
			gql.Vulnerability_affected_update_columnVulnerabilityId,
		},
	}

	VulnerabilityPackageOnConflict = &gql.Package_on_conflict{
		Constraint: gql.Package_constraintPackagePackageManagerCustomRegistryNameIdx,
		Update_columns: []gql.Package_update_column{
			gql.Package_update_columnName,
			gql.Package_update_columnPackageManager,
			gql.Package_update_columnCustomRegistry,
		},
	}

	VulnerabilityAffectedRangeOnConflict = &gql.Vulnerability_affected_range_event_on_conflict{
		Constraint: gql.Vulnerability_affected_range_event_constraintAffectedRangeEventAffectedIdTypeEventVersionIdx,
		Update_columns: []gql.Vulnerability_affected_range_event_update_column{
			gql.Vulnerability_affected_range_event_update_columnAffectedId,
			gql.Vulnerability_affected_range_event_update_columnType,
			gql.Vulnerability_affected_range_event_update_columnEvent,
			gql.Vulnerability_affected_range_event_update_columnVersion,
		},
	}

	RangeOnConflict = &gql.Vulnerability_range_on_conflict{
		Constraint: gql.Vulnerability_range_constraintRangeUniq,
		Update_columns: []gql.Vulnerability_range_update_column{
			gql.Vulnerability_range_update_columnFixed,
			gql.Vulnerability_range_update_columnIntroduced,
			gql.Vulnerability_range_update_columnAffectedId,
		},
	}

	VulnerabilityAffectedVersion = &gql.Vulnerability_affected_version_on_conflict{
		Constraint: gql.Vulnerability_affected_version_constraintAffectedVersionAffectedIdTypeVersion,
		Update_columns: []gql.Vulnerability_affected_version_update_column{
			gql.Vulnerability_affected_version_update_columnAffectedId,
			gql.Vulnerability_affected_version_update_columnVersion,
		},
	}
)
